import accounting from 'accounting';
import React, { PureComponent } from 'react';
import { XYAxisChartsC } from '../../../../../components';

export default class TradeStatistics extends PureComponent {
  constructor(props) {
    super(props);
    this.state = {};
  }

  componentDidMount() {}

  render() {
    const { echartsdata = {}, quickQuerytype = '', loading } = this.props;
    const { xAxis = [], series = [] } = echartsdata[quickQuerytype] || {};

    const newSeries = series.map((x) => {
      if (x.name == '交易笔数') {
        return { ...x, type: 'line', yAxisIndex: 1 };
      } else {
        return { ...x, data: x.data.map((r) => parseInt(r * 10000) / 100000000.0), type: 'bar', toFixed: 4 };
      }
    });

    return (
      <div style={{ marginTop: '20px' }}>
        <XYAxisChartsC
          series={newSeries}
          xAxis={xAxis}
          // gridLeft='100'
          height={380}
          yAxisUnit={['单位(万元)', '单位(笔)']}
          type='bar'
          loading={loading}
        />
      </div>
    );
  }
}
